package lichbaogiang;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;


public class GetDataTeacher {
   
    public static String dsgv[][]= new String[100][4];
    public static int count_row = 0;
    String data[] = new String[20];
    
    Connection conn;
    Statement stmt;
    ResultSet rs;
    ResultSetMetaData rsmd;
    String url;
    
    public GetDataTeacher()
    {
        String sql = "select * from GiangVien1";
            url = "jdbc:odbc:CNPM";
            try{
            conn = DriverManager.getConnection(url);
            stmt = conn.createStatement();
            rs = stmt.executeQuery(sql);
            rsmd = rs.getMetaData();
                System.out.println("connection start....");
            while(rs.next())
            { 
                dsgv[count_row][0] = rs.getString(1); // Lấy mã giảng viên
                dsgv[count_row][1] =rs.getString(2);  //Lấy Tên Giảng viên
                dsgv[count_row][2] = String.valueOf(rs.getFloat(9));  //Lấy Điểm Giảng viên
                dsgv[count_row][3] = rs.getString(10);  //lấy Chuyên môn của Giảng viên
                count_row++;  
                //System.out.println(rs.getString(1)+"  "+rs.getString(2)+"  "+rs.getString(3));
            }
        } catch(Exception ex){  
          System.out.println("Error " + ex); }
    }
}
